package com.gmail.dengtao.joe.group.member;

import com.gmail.dengtao.joe.group.channel.Channel;




/**
 * The MembershipListener interface is used as a callback to the
 * membership service. It has two methods that will notify the listener
 * when a member has joined the group and when a member has disappeared (crashed)
 * 
 * @author <a href="mailto:joe.dengtao@gmail.com">DengTao</a>
 * @version 1.0
 * @since 1.0
 */
public interface MembershipListener {
	
	/**
     * A member was added to the group
	 * @param channel 
     * @param member Member - the member that was added
     */
    public void memberAdded(Channel channel, Member member) throws Exception;

    /**
     * A member reach it's Idle time.
     * @param member
     * @param status
     * @since 1.0
     */
    public void memberIdle(Channel channel, Member member, IdleStatus status) throws Exception;

    /**
     * A member was removed from the group<br>
     * If the member left voluntarily, the Member.getCommand will contain the Member.SHUTDOWN_PAYLOAD data
     * @param member Member
     * @see Member#SHUTDOWN_PAYLOAD
     */
    public void memberDisappeared(Channel channel, Member member) throws Exception;

}